let express = require('express')
let app = express()

app.all('*',(req,res,next)=>{
    res.header('Access-Control-Allow-Origin',"*")
    next()
})

app.get('/user',(req,res)=>{
    let {id,name} = req.query
    let data = {
        id: id,
        name: name || 'yasuo'
    }
    res.send(data)
})
app.get('/cate',(req,res)=>{
    let {id} = req.query
    res.send('yasuo'+id)
})

app.post('/user',(req,res)=>{
    let {id,name} = req.body
    let data = {
        id: id,
        name: name || 'gailun'
    }
    res.send(data)
})

app.listen(3000,()=>{
    console.log('start')
})